/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rule;

import java.util.ArrayList;

/**
 *
 * @author Omega
 */
public class RuleValidator {
    private ArrayList<NewRule> list = new ArrayList<NewRule>();
    
   public RuleValidator(ArrayList<NewRule> l){
       list = l;
   }           
    
     public boolean ruleValue(){
         boolean aux = false;
             
        for(NewRule r : list)
        {
            if(r.ruleValue())
                aux = true;
            else
                return false;
        }
        
        return aux;
    }
     
     public String message(){
         StringBuffer m = new StringBuffer("");
         for(NewRule r : list)
        {
            if(r.ruleValue())
            {
                m.append(r.outputMessage());
                m.append("\n");
            }
        }
         
         return m.toString();
     }
     
     public int complexRuleScore(){
         int score = 0;
          for(NewRule r : list)
              score += r.getTotalPunctuation();
          
          return score;
     }
}
